Since commit
1ebb162a00bf6c4b0 moved JS sources into resources,
the extension-prefs tool was broken. To fix it, we would either
need to generate an external GResource in addition to the generated
C code and teach gjs-console about loading it before evaluating
the script, or turn gnome-shell-extension-prefs into a binary with
the JS resources compiled in.
https://bugzilla.gnome.org/show_bug.cgi?id=722334
CLEANFILES += $(gir_DATA) $(typelib_DATA)
-bin_SCRIPTS += gnome-shell-extension-tool gnome-shell-extension-prefs \
- gnome-shell-perf-tool
-EXTRA_DIST += gnome-shell-extension-tool.in gnome-shell-extension-prefs.in \
- gnome-shell-perf-tool.in
-bin_PROGRAMS = gnome-shell
+bin_SCRIPTS += gnome-shell-extension-tool gnome-shell-perf-tool
+EXTRA_DIST += gnome-shell-extension-tool.in gnome-shell-perf-tool.in
+bin_PROGRAMS = gnome-shell gnome-shell-extension-prefs
if HAVE_MUTTER_WAYLAND
bin_PROGRAMS += gnome-shell-wayland
gnome-shell-extension-tool: gnome-shell-extension-tool.in Makefile
$(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
-gnome-shell-extension-prefs: gnome-shell-extension-prefs.in Makefile
- $(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
-
gnome-shell-perf-tool: gnome-shell-perf-tool.in Makefile
$(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@
gnome_shell_wayland_DEPENDENCIES = libgnome-shell-wayland.la
endif HAVE_MUTTER_WAYLAND
+gnome_shell_extension_prefs_SOURCES = gnome-shell-extension-prefs.c \
+ $(top_builddir)/js/js-resources.c \
+ $(top_builddir)/js/js-resources.h \
+ $(NULL)
+gnome_shell_extension_prefs_CPPFLAGS = $(gnome_shell_cflags)
+gnome_shell_extension_prefs_LDADD = libgnome-shell-js.la
+
########################################
libgnome_shell_js_la_SOURCES = \
--- /dev/null
+#include "config.h"
+
+#include <girepository.h>
+#include <gjs/gjs.h>
+
+int
+main (int argc, char *argv)
+{
+ const char *search_path[] = { "resource:///org/gnome/shell", NULL };
+ GError *error = NULL;
+ GjsContext *context;
+ int status;
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ g_irepository_prepend_search_path (GNOME_SHELL_PKGLIBDIR);
+
+ context = g_object_new (GJS_TYPE_CONTEXT,
+ "search-path", search_path,
+ NULL);
+
+ if (!gjs_context_define_string_array(context, "ARGV",
+ argc - 1, (const char**)argv + 1,
+ &error))
+ {
+ g_message("Failed to defined ARGV: %s", error->message);
+ g_error_free (error);
+
+ return 1;
+ }
+
+
+ if (!gjs_context_eval (context,
+ "const Main = imports.extensionPrefs.main; Main.main(ARGV);",
+ -1,
+ "<main>",
+ &status,
+ &error))
+ {
+ g_message ("Execution of main.js threw exception: %s", error->message);
+ g_error_free (error);
+
+ return status;
+ }
+
+ return 0;
+}
+++ /dev/null
-#!/bin/sh
-
-if [ -z "$GI_TYPELIB_PATH" ]; then
- export GI_TYPELIB_PATH=@pkglibdir@
-else
- export GI_TYPELIB_PATH=@pkglibdir@:$GI_TYPELIB_PATH
-fi
-
-if [ -z "$LD_LIBRARY_PATH" ] ; then
- export LD_LIBRARY_PATH=@pkglibdir@
-else
- export LD_LIBRARY_PATH=@pkglibdir@:$LD_LIBRARY_PATH
-fi
-
-@GJS_CONSOLE@ -I @pkgdatadir@/js -c "const Main = imports.extensionPrefs.main; Main.main(ARGV);" "$@"